﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OAuth;
using OAuth.ServiceProviders;
using WebUtils;

namespace YammerAPI
{
    class YammerSessionParameter : IOAuthSessionParameter
    {
        public YammerSessionParameter(
            string pConsumerKey,
            string pConsumerSecret,
            IAccessTokenStorage pTokenStorage,
            Func<string, string> pUserAuthRedirection)
        {
            yammer = new Yammer(pUserAuthRedirection);
            ConsumerKey = pConsumerKey;
            ConsumerSecret = pConsumerSecret;
            TokenStorage = pTokenStorage;
        }

        readonly Yammer yammer;

        public string ConsumerKey { get; private set; }
        /*{
            //get { return "ym2pUoszQMHrRinIiWQ0g"; }
            //get { return "3HLCKYlqH4WSwQRdJpmcSQ"; }
            get { return "cGp6TWVRuYZpKdiEMwYd2Q"; }
        }*/

        public string ConsumerSecret { get; private set; }
        /*{
            //get { return "eVXjAYGMZKqD9JTa5YoVZgHHHtDqLFFXxALyUfsQ1c"; }
            //get { return "DB8VHY50K4GXCyy2BKjr9eWxppJc51It3gymVPriw8"; }
            get { return "7LpyLO06kwPPYVC1NkwkPzMZFck9HZyV0TBkFa7gSc"; }
        }*/

        public OAuth.IServiceProvider ServiceProvider { get { return yammer; } }
        public IAccessTokenStorage TokenStorage { get; set; }
        public string CallWeb(ISignedWebRequest pRequest) { return Utils.CallWeb(pRequest); }
    }
}
